package org.zfes.snowier.cloud.zbss.cms.router.service.content;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.content.model.CmsContentChargeRecord;
import org.zfes.snowier.cloud.zbss.cms.content.service.ICmsContentChargeRecordService;
@Controller("org.zfes.snowier.cloud.zbss.cms.router.service.content.CmsContentChargeRecordController") 
@RequestMapping("/cms/service/content/cmsContentChargeRecord")
public class CmsContentChargeRecordController extends BaseController {

	
	@Autowired
	private ICmsContentChargeRecordService cmsContentChargeRecordService;
	
	@RequiresPermissions(value="cmsContentChargeRecord:loadCmsContentChargeRecordDataSet",desc="内容付费记录列表")
    @RequestMapping(value="/loadCmsContentChargeRecordDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentChargeRecordDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsContentChargeRecordService.loadCmsContentChargeRecordDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsContentChargeRecord:createCmsContentChargeRecord",desc="内容付费记录添加")
    @RequestMapping(value="/createCmsContentChargeRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsContentChargeRecord(CmsContentChargeRecord cmsContentChargeRecord){
		cmsContentChargeRecordService.createCmsContentChargeRecord(cmsContentChargeRecord);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentChargeRecord:loadCmsContentChargeRecord",desc="内容付费记录加载")
    @RequestMapping(value="/loadCmsContentChargeRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentChargeRecord(Long id){
		Optional<CmsContentChargeRecord> ops = cmsContentChargeRecordService.loadCmsContentChargeRecordById(id);
		return ajaxQuery("cmsContentChargeRecord",ops);
    }
	
	@RequiresPermissions(value="cmsContentChargeRecord:updateCmsContentChargeRecord",desc="内容付费记录更新")
    @RequestMapping(value="/updateCmsContentChargeRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsContentChargeRecord(CmsContentChargeRecord cmsContentChargeRecord){
		cmsContentChargeRecordService.updateCmsContentChargeRecord(cmsContentChargeRecord);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentChargeRecord:deletCmsContentChargeRecord",desc="内容付费记录删除")
    @RequestMapping(value="/deleteCmsContentChargeRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsContentChargeRecord(Long id){
		cmsContentChargeRecordService.deleteCmsContentChargeRecord(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}